﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using UDS.Components;

namespace UDS.SubModule.CM
{
    /// <summary>
    /// Clinet 的摘要说明。
    /// </summary>
    public partial class ClientPage : Page
    {
        private int _clientId;
        protected int CurrentClientID
        {
            get { return _clientId; }
            private set { _clientId = value; }
        }

        private void Page_Load(object sender, EventArgs e)
        {
            var cm = new Components.CM();

            if (!Page.IsPostBack)
            {
                tbx_UpdateTime.Text = DateTime.Now.ToShortDateString();
                //得到添加人的信息
                var staff = new Components.Staff();

                #region 显示客户原有信息

                ClientInfo client = cm.GetClientAllInfo((Request.QueryString["ClientID"] == null) ? 0 : Int32.Parse(Request.QueryString["ClientID"]));
                ViewState["ClientID"] = client.ID;
                _clientId = client.ID;

                /* 权限判断
				 * 如果是上级则出现下拉菜单，并可重新指定客户经理
				 * 其它则无下拉菜单
				 */
                if (Session["cm_permission"].ToString() == "leader")
                {
                    //绑定下拉列表
                    pnl_Leader.Visible = true;
                    ltl_AddManName.Visible = ltl_addmantel.Visible = false;
                    //不出现修改按钮
                    pnl_MyCustom.Visible = false;
                    pnl_Leader1.Visible = true;

                    BindAddManList();
                    //添加人默认选中
                    ddl_AddMan.Items.FindByValue(client.AddManID.ToString()).Selected = true;
                }
                else
                {
                    pnl_Leader.Visible = false;
                    ltl_AddManName.Visible = ltl_addmantel.Visible = true;

                    var staffInfo = Staff.GetStaffInfo(client.ID != 0 ? client.AddManID : SiteContext.Current.UserID);
                    if (staffInfo != null)
                    {
                        ltl_AddManName.Text = staffInfo.RealName;
                        ltl_addmantel.Text = staffInfo.Mobile;
                    }
                }


                ltl_ID.Text = (client.ID.ToString() == "0") ? "" : client.ID.ToString();
                tbx_ShortName.Text = client.ClientShortName;
                tbx_Name.Text = client.ClientName;
                if (_clientId != 0)
                    tbx_Birthday.Text = client.Birthday.ToShortDateString();
                else
                    tbx_Birthday.Text = DateTime.Now.ToShortDateString();

                if (client.ClientType.IndexOf(ClientType.terminal.ToString()) >= 0) cbx_zhongduan.Checked = true;
                if (client.ClientType.IndexOf(ClientType.channal.ToString()) >= 0) cbx_qudao.Checked = true;
                if (client.ClientType.IndexOf(ClientType.social.ToString()) >= 0) cbx_shehui.Checked = true;
                if (client.ClientType.IndexOf(ClientType.media.ToString()) >= 0) cbx_meiti.Checked = true;
                //得到主要联系人的信息
                SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString());
                while (dr_chief.Read())
                {
                    if (Session["cm_permission"].ToString() == "administrator")
                    {
                        hlk_Chiefman.Text = dr_chief["name"].ToString();
                        hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"];
                        hlk_Chiefman.Target = "_blank";
                    }
                    else
                    {
                        hlk_Chiefman.Text = dr_chief["name"].ToString();
                    }

                    lbl_position.Text = dr_chief["position"].ToString();
                    lbl_chieftel.Text = dr_chief["telephone"].ToString();
                }
                dr_chief.Close();
                tbx_affiliatedarea.Text = client.Affiliatedarea;
                tbx_URL.Text = client.URL;
                tbx_zip.Text = client.ZIP;
                tbx_address.Text = client.Address;

                if (client.CompanyProperty.IndexOf(EnterpriseType.government.ToString()) >= 0) cbx_government.Checked = true;
                if (client.CompanyProperty.IndexOf(EnterpriseType.contry.ToString()) >= 0) cbx_stateowned.Checked = true;
                if (client.CompanyProperty.IndexOf(EnterpriseType.privateowned.ToString()) >= 0) cbx_private.Checked = true;
                if (client.CompanyProperty.IndexOf(EnterpriseType.oversea.ToString()) >= 0) cbx_foreign.Checked = true;
                if (client.CompanyProperty.IndexOf(EnterpriseType.stock.ToString()) >= 0) cbx_market.Checked = true;

                if (client.ClientTrade.IndexOf(ClientTrade.realty.ToString()) >= 0) cbx_realestate.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.IT.ToString()) >= 0) cbx_IT.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.business.ToString()) >= 0) cbx_business.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.telecom.ToString()) >= 0) cbx_telecom.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.post.ToString()) >= 0) cbx_post.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.refer.ToString()) >= 0) cbx_consultation.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.travel.ToString()) >= 0) cbx_travel.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.bus.ToString()) >= 0) cbx_bus.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.stock.ToString()) >= 0) cbx_stock.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.insurance.ToString()) >= 0) cbx_insurance.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.tax.ToString()) >= 0) cbx_tax.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.make.ToString()) >= 0) cbx_make.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.he.ToString()) >= 0) cbx_electric.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.clothe.ToString()) >= 0) cbx_clothe.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.food.ToString()) >= 0) cbx_food.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.medicine.ToString()) >= 0) cbx_medicine.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.mechanism.ToString()) >= 0) cbx_mechanism.Checked = true;
                if (client.ClientTrade.IndexOf(ClientTrade.auto.ToString()) >= 0) cbx_auto.Checked = true;

                tbx_staffnumber.Text = client.CompanySize;
                tbx_money.Text = client.Money;
                tbx_operation.Text = client.Operation;
                tbx_introduce.Text = client.Introduce;
                tbx_IT.Text = client.ITGrade;
                tbx_pcnumber.Text = client.PCNumber.ToString();

                if (client.Net.IndexOf(ClientNet.LAN.ToString()) >= 0) cbx_LAN.Checked = true;
                if (client.Net.IndexOf(ClientNet.WAN.ToString()) >= 0) cbx_WAN.Checked = true;
                if (client.Net.IndexOf(ClientNet.INTERNET.ToString()) >= 0) cbx_internet.Checked = true;

                tbx_ITStaffs.Text = client.ITStaffs.ToString();
                tbx_ITdepartment.Text = client.ITDepartment;
                tbx_principal.Text = client.Principal;
                tbx_system.Text = client.System;

                if (client.ClientSource.IndexOf(ClientSource.sellman.ToString()) >= 0) cbx_sellman.Checked = true;
                if (client.ClientSource.IndexOf(ClientSource.familiar.ToString()) >= 0) cbx_just.Checked = true;
                if (client.ClientSource.IndexOf(ClientSource.introduce.ToString()) >= 0) cbx_introduce.Checked = true;
                if (client.ClientSource.IndexOf(ClientSource.client.ToString()) >= 0) cbx_customer.Checked = true;

                if (client.ClientInitiative.IndexOf(ClientInitiative.media.ToString()) >= 0) cbx_media.Checked = true;
                if (client.ClientInitiative.IndexOf(ClientInitiative.searchweb.ToString()) >= 0) cbx_Web.Checked = true;
                if (client.ClientInitiative.IndexOf(ClientInitiative.proseminar.ToString()) >= 0) cbx_proseminar.Checked = true;
                if (client.ClientInitiative.IndexOf(ClientInitiative.exhibition.ToString()) >= 0) cbx_exhibition.Checked = true;
                if (client.ClientInitiative.IndexOf(ClientInitiative.post.ToString()) >= 0) cbx_EMS.Checked = true;
                if (client.ClientInitiative.IndexOf(ClientInitiative.email.ToString()) >= 0) cbx_Email.Checked = true;

                #endregion

                if (_clientId == 0)
                {
                    btn_OK.Text = "添加";
                    CustomValidator1.Enabled = true;
                }
                else
                {
                    btn_OK.Text = "修改";
                    CustomValidator1.Enabled = false;
                }

                penal.Visible = cbx_customer.Checked;
            }
            else
            {
                _clientId = Int32.Parse(ViewState["ClientID"].ToString());

                //显示联系人
                string tmplinkmanid1 = (Session["tmplinkmanid"] == null) ? "" : Session["tmplinkmanid"].ToString();
                foreach (string linkmanid in tmplinkmanid1.Split(','))
                {
                    if (linkmanid.Trim() != "")
                    {
                        var cm1 = new Components.CM();
                        var linkman = cm1.GetLinkmanStructByID(linkmanid);

                        if (Session["cm_permission"].ToString() == "administrator")
                        {
                            hlk_Chiefman.Text = linkman.Name;
                            hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + linkman.ID;
                            hlk_Chiefman.Target = "_blank";
                        }
                        else
                        {
                            hlk_Chiefman.Text = linkman.Name;
                        }

                        lbl_position.Text = linkman.Position;
                        lbl_chieftel.Text = linkman.Telephone;
                    }
                }
            }

            if (_clientId != 0)
            {
                rpt_Attachment.DataSource = cm.GetAttachmentByClientID(_clientId);
                rpt_Attachment.DataBind();
            }

            if (_clientId == 0)
                btn_AddContact.Visible = false;
            else
                btn_AddContact.Visible = true;
        }

        //绑定添加人下拉菜单
        private void BindAddManList()
        {
            var staffList = Staff.GetStaffFromPosition(SiteContext.Current.UserName, false);
            ddl_AddMan.Items.Clear();
            foreach (var staff in staffList)
            {
                ddl_AddMan.Items.Add(new ListItem(staff.RealName, staff.ID.ToString()));
            }

            string myrealname = "";
            var staffInfo = Staff.GetStaffInfo(SiteContext.Current.UserID);
            if (staffInfo != null)
            {
                myrealname = staffInfo.RealName;
            }
            ddl_AddMan.Items.Add(new ListItem(myrealname, SiteContext.Current.UserID.ToString()));
        }

        private void btn_OK_Click(object sender, EventArgs e)
        {
            var cm = new Components.CM();
            ClientInfo client = cm.GetClientAllInfo(_clientId);
            if (Page.IsValid)
            {
                #region 填充client结构

                client.ClientShortName = tbx_ShortName.Text;
                client.ClientName = tbx_Name.Text;
                client.AddManID = SiteContext.Current.UserID;
                client.UpdateTime = DateTime.Parse(tbx_UpdateTime.Text);
                client.Affiliatedarea = tbx_affiliatedarea.Text;
                client.URL = tbx_URL.Text;
                client.ZIP = tbx_zip.Text;
                client.Address = tbx_address.Text;
                client.Type = "";

                if (cbx_zhongduan.Checked)
                {
                    client.Type += ClientType.terminal + ",";
                }
                if (cbx_qudao.Checked)
                {
                    client.Type += ClientType.channal + ",";
                }
                if (cbx_shehui.Checked)
                {
                    client.Type += ClientType.social + ",";
                }
                if (cbx_meiti.Checked)
                {
                    client.Type += ClientType.media + ",";
                }

                client.EnterpriseType = "";
                if (cbx_government.Checked)
                {
                    client.EnterpriseType += EnterpriseType.government + ",";
                }
                if (cbx_stateowned.Checked)
                {
                    client.EnterpriseType += EnterpriseType.contry + ",";
                }
                if (cbx_private.Checked)
                {
                    client.EnterpriseType += EnterpriseType.privateowned + ",";
                }
                if (cbx_foreign.Checked)
                {
                    client.EnterpriseType += EnterpriseType.oversea + ",";
                }

                if (cbx_market.Checked) client.EnterpriseType += EnterpriseType.stock + ",";

                client.Calling = "";
                if (cbx_realestate.Checked) client.Calling += ClientTrade.realty + ",";
                if (cbx_IT.Checked) client.Calling += ClientTrade.IT + ",";
                if (cbx_business.Checked) client.Calling += ClientTrade.business + ",";
                if (cbx_telecom.Checked) client.Calling += ClientTrade.telecom + ",";
                if (cbx_post.Checked) client.Calling += ClientTrade.post + ",";
                if (cbx_consultation.Checked) client.Calling += ClientTrade.refer + ",";
                if (cbx_travel.Checked) client.Calling += ClientTrade.travel + ",";
                if (cbx_bus.Checked) client.Calling += ClientTrade.bus + ",";
                if (cbx_stock.Checked) client.Calling += ClientTrade.stock + ",";
                if (cbx_insurance.Checked) client.Calling += ClientTrade.insurance + ",";
                if (cbx_tax.Checked) client.Calling += ClientTrade.tax + ",";
                if (cbx_make.Checked) client.Calling += ClientTrade.make + ",";
                if (cbx_electric.Checked) client.Calling += ClientTrade.he + ",";
                if (cbx_clothe.Checked) client.Calling += ClientTrade.clothe + ",";
                if (cbx_food.Checked) client.Calling += ClientTrade.food + ",";
                if (cbx_medicine.Checked) client.Calling += ClientTrade.medicine + ",";
                if (cbx_mechanism.Checked) client.Calling += ClientTrade.mechanism + ",";
                if (cbx_auto.Checked) client.Calling += ClientTrade.auto + ",";

                client.CompanySize = tbx_staffnumber.Text;
                client.Money = tbx_money.Text;
                client.Operation = tbx_operation.Text;
                client.Introduce = tbx_introduce.Text;
                client.ITGrade = tbx_IT.Text;
                client.PCNumber = Int32.Parse(tbx_pcnumber.Text);

                client.Net = "";
                if (cbx_LAN.Checked) client.Net += ClientNet.LAN + ",";
                if (cbx_WAN.Checked) client.Net += ClientNet.WAN + ",";
                if (cbx_internet.Checked) client.Net += ClientNet.INTERNET + ",";
                client.ITStaffs = Int32.Parse(tbx_ITStaffs.Text);
                client.ITDepartment = tbx_ITdepartment.Text;
                client.Principal = tbx_principal.Text;
                client.System = tbx_system.Text;

                client.ClientSource = "";
                if (cbx_sellman.Checked) client.ClientSource += ClientSource.sellman + ",";
                if (cbx_just.Checked) client.ClientSource += ClientSource.familiar + ",";
                if (cbx_introduce.Checked) client.ClientSource += ClientSource.introduce + ",";
                if (cbx_customer.Checked) client.ClientSource += ClientSource.client + ",";

                client.ClientInitiative = "";
                if (cbx_media.Checked) client.ClientInitiative += ClientInitiative.media + ",";
                if (cbx_Web.Checked) client.ClientInitiative += ClientInitiative.searchweb + ",";
                if (cbx_proseminar.Checked) client.ClientInitiative += ClientInitiative.proseminar + ",";
                if (cbx_exhibition.Checked) client.ClientInitiative += ClientInitiative.exhibition + ",";
                if (cbx_EMS.Checked) client.ClientInitiative += ClientInitiative.post + ",";
                if (cbx_Email.Checked) client.ClientInitiative += ClientInitiative.email + ",";

                #endregion

                client.ChiefLinkmanID = (Session["tmpchief"] == null) ? 0 : Int32.Parse(Session["tmpchief"].ToString());

                //根据clientid==0判断是update还是add
                try
                {
                    if (_clientId != 0) //修改
                    {
                        SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString());
                        while (dr_chief.Read())
                        {
                            if (Session["cm_permission"].ToString() == "administrator")
                            {
                                hlk_Chiefman.Text = dr_chief["name"].ToString();
                                hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"];
                                hlk_Chiefman.Target = "_blank";
                            }
                            else
                            {
                                hlk_Chiefman.Text = dr_chief["name"].ToString();
                            }
                        }
                        dr_chief.Close();
                        cm.UpdateClient(client);
                        Response.Write("<script>alert('修改成功！');opener.location.href=opener.location.href;close();</script>");
                    }
                    else //新增
                    {
                        CustomValidator1.Enabled = true;
                        CustomValidator1.Validate();
                        string tmplinkmanid = (Session["tmplinkmanid"] == null) ? "" : Session["tmplinkmanid"].ToString();
                        client.Birthday = DateTime.Now;
                        client.ID = cm.AddClinet(client);
                        ViewState["ClientID"] = client.ID.ToString();
                        ltl_ID.Text = client.ID.ToString();
                        _clientId = client.ID;
                        SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString());
                        while (dr_chief.Read())
                        {
                            if (Session["cm_permission"].ToString() == "administrator")
                            {
                                hlk_Chiefman.Text = dr_chief["name"].ToString();
                                hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"];
                                hlk_Chiefman.Target = "_blank";
                            }
                            else
                            {
                                hlk_Chiefman.Text = dr_chief["name"].ToString();
                            }
                            lbl_position.Text = dr_chief["Position"].ToString();
                            lbl_chieftel.Text = dr_chief["Telephone"].ToString();
                        }
                        dr_chief.Close();
                        //分析session中的tmplinkmanid使他们得到clientid
                        foreach (string linkmanid in tmplinkmanid.Split(','))
                        {
                            if (linkmanid.Trim() != "")
                            {
                                var cm1 = new Components.CM();
                                var linkman = cm1.GetLinkmanStructByID(linkmanid);
                                linkman.ClientID = client.ID;
                                linkman.ID = Int32.Parse(linkmanid);
                                cm.UpdateLinkman(linkman);
                            }
                        }
                        //清空Session
                        Session.Remove("tmpchief");
                        Session.Remove("tmplinkmanid");
                        Response.Write("<script>alert('添加成功！');opener.location.href=opener.location.href;close();</script>");
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex.Message);
                    Server.Transfer("../Error.aspx");
                }
                //Response.Write("<script>if(opener!=null) opener.location.reload();</script>");
                //刷新页面显示
                if (_clientId == 0)
                    btn_AddContact.Visible = false;
                else
                    btn_AddContact.Visible = true;

                penal.Visible = cbx_customer.Checked;

                //上传附件
                UploadAtt();

                //显示附件
                if (_clientId != 0)
                {
                    rpt_Attachment.DataSource = cm.GetAttachmentByClientID(_clientId);
                    rpt_Attachment.DataBind();
                }
            }
        }

        /// <summary>
        /// 判断是否有同名客户
        /// </summary>
        /// <param name="newclientname"></param>
        /// <returns></returns>
        private static bool SameNameClient(string newclientname)
        {
            var cm = new Components.CM();
            SqlDataReader dr = cm.GetClientInfoByName(newclientname);
            DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
            if (dt.Rows.Count == 0)
                return (false);

            return (true);
        }

        /// <summary>
        /// 上载文件
        /// </summary>
        private void UploadAtt()
        {
            var FrmCompose = (HtmlForm)Page.FindControl("Client");
            var cm = new Components.CM();

            string FileName;
            string Extension;
            string SavedName;
            try
            {
                if (Directory.Exists(Server.MapPath(".") + "\\Attachment"))
                {
                    for (int i = 0; i < FrmCompose.Controls.Count; i++)
                    {
                        if (FrmCompose.Controls[i].GetType().ToString() == "System.Web.UI.HtmlControls.HtmlInputFile")
                        {
                            var hif = ((HtmlInputFile)(FrmCompose.Controls[i]));
                            if (hif.PostedFile.FileName.Trim() != "")
                            {
                                FileName = Path.GetFileName(hif.PostedFile.FileName);
                                Extension = Path.GetExtension(hif.PostedFile.FileName);

                                SavedName = cm.InsertFile(FileName, "client", _clientId, Extension).ToString();

                                hif.PostedFile.SaveAs(Server.MapPath(".") + "\\Attachment\\" + SavedName + Extension);
                            }
                        }
                    }
                }
                else
                {
                    Directory.CreateDirectory(Server.MapPath(".") + "\\Attachment");
                    UploadAtt();
                }
            }
            catch (Exception ioex)
            {
                Logger.Log(ioex.ToString());
                Server.Transfer("../Error.aspx");
            }
        }

        private void cbx_customer_PreRender(object sender, EventArgs e)
        {
            //Response.Write("<script>if(document.Client.cbx_customer.checked) document.Client.penal.style.display='';else document.Client.penal.style.display='none';</script>");
        }

        private void cbx_customer_CheckedChanged(object sender, EventArgs e)
        {
            penal.Visible = ((CheckBox)sender).Checked;
        }

        private void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = !SameNameClient(args.Value);
        }

        private void tbx_ShortName_TextChanged(object sender, EventArgs e)
        {
        }

        private void btn_AddContact_Click(object sender, EventArgs e)
        {
            Response.Write("<script>window.open('ClientContact_thisWeek.aspx?ClientID=" + _clientId + "','_blank','');</script>");
        }

        private void btn_LookTel_Click(object sender, EventArgs e)
        {
            ltl_addmantel.Visible = true;

            var staffInfo = Staff.GetStaffInfo(Int32.Parse(ddl_AddMan.SelectedItem.Value));
            if (staffInfo != null)
            {
                ltl_addmantel.Text = staffInfo.Mobile;
            }
        }

        private void btn_ChangeAddMan_Click(object sender, EventArgs e)
        {
            var cm = new Components.CM();
            ClientInfo client = cm.GetClientAllInfo(_clientId);
            if (Page.IsValid)
            {
                client.AddManID = Int32.Parse(ddl_AddMan.SelectedItem.Value);
                cm.UpdateClient(client);
                //判断权限
                if (ddl_AddMan.SelectedItem.Value == SiteContext.Current.UserID.ToString())
                {
                    Session["cm_permission"] = "administrator";
                }
                else
                    Session["cm_permission"] = "leader";

                Response.Write("<script>alert('修改成功！');opener.location.href='ClientListView.aspx';close();</script>");
            }
        }

        private void btn_LookContact_Click(object sender, EventArgs e)
        {
            Response.Write("<script>window.open('ClientHistoryContact.aspx?ClientID=" + _clientId + "','_blank','');</script>");
        }

        #region Web Form Designer generated code

        protected override void OnInit(EventArgs e)
        {
            //
            // CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.CustomValidator1.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.CustomValidator1_ServerValidate);
            this.tbx_ShortName.TextChanged += new System.EventHandler(this.tbx_ShortName_TextChanged);
            this.btn_LookTel.Click += new System.EventHandler(this.btn_LookTel_Click);
            this.btn_ChangeAddMan.Click += new System.EventHandler(this.btn_ChangeAddMan_Click);
            this.cbx_customer.CheckedChanged += new System.EventHandler(this.cbx_customer_CheckedChanged);
            this.cbx_customer.PreRender += new System.EventHandler(this.cbx_customer_PreRender);
            this.btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
            this.btn_AddContact.Click += new System.EventHandler(this.btn_AddContact_Click);
            this.btn_LookContact.Click += new System.EventHandler(this.btn_LookContact_Click);
            this.Load += new System.EventHandler(this.Page_Load);
        }

        #endregion
    }
}